package com.road.crawler.meizitu.crawler;

import java.util.List;

import com.geccocrawler.gecco.GeccoEngine;
import com.geccocrawler.gecco.annotation.Gecco;
import com.geccocrawler.gecco.annotation.Html;
import com.geccocrawler.gecco.annotation.HtmlField;
import com.geccocrawler.gecco.annotation.Request;
import com.geccocrawler.gecco.annotation.RequestParameter;
import com.geccocrawler.gecco.annotation.Text;
import com.geccocrawler.gecco.request.HttpGetRequest;
import com.geccocrawler.gecco.request.HttpRequest;
import com.geccocrawler.gecco.spider.HtmlBean;

/**
 * @Description :
 * @FileName: SecondPage.java
 * @Author :WeiHui.Zhang
 * @Data : 2016年3月29日 上午11:45:17
 * @Version:V1.00
 */
@Gecco(matchUrl = "http://blog.csdn.net/shipeng22022/article/details/{id}", pipelines = { "consolePipeline",
		"nextPagePipeline" })
public class SecondPage implements HtmlBean {

	private static final long serialVersionUID = 1L;

	@Text
	@HtmlField(cssPath = "#article_details > div.article_title > h1 > span > a")
	private String title;

	@Html
	@HtmlField(cssPath = "#article_content > div")
	private String content;

	@Text
	@HtmlField(cssPath = "#article_details > div.category.clearfix > div.category_r > label > span:eq(0)")
	private String category;

	@HtmlField(cssPath = "#article_details > div.article_manage.clearfix > div.article_l > span > a")
	private List<String> keywords;

	@RequestParameter
	private String id;

	@Request
	private HttpRequest request;

	// @RequestParameter
	// private int currPage;

	// @Href
	// @HtmlField(cssPath = "#wp_page_numbers > ul > li:last-child > a")
	// private String lastPageUrl;

	// @HtmlField(cssPath = ".wp-list > li")
	// private List<Picture> pictures;

	// public List<Picture> getPictures() {
	// return pictures;
	// }
	//
	// public void setPictures(List<Picture> pictures) {
	// this.pictures = pictures;
	// }

	public HttpRequest getRequest() {
		return request;
	}

	public List<String> getKeywords() {
		return keywords;
	}

	public void setKeywords(List<String> keywords) {
		this.keywords = keywords;
	}

	public void setRequest(HttpRequest request) {
		this.request = request;
	}

	// public int getCurrPage() {
	// return currPage;
	// }
	//
	// public void setCurrPage(int currPage) {
	// this.currPage = currPage;
	// }

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	// public String getLastPageUrl() {
	// return lastPageUrl;
	// }
	//
	// public void setLastPageUrl(String lastPageUrl) {
	// this.lastPageUrl = lastPageUrl;
	// }

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public static void main(String[] args) {
		HttpRequest request = new HttpGetRequest("http://www.meizitu.com/tag/suxiong_17_8.html");
		request.setCharset("GBK");
		GeccoEngine.create().classpath("com.road.crawler.meizitu").start(request).interval(2000).run();
	}

	@Override
	public String toString() {
		return "SecondPage [title=" + title + ", content=" + content + ", id=" + id + ", request=" + request + "]";
	}

}
